<template>
	<view>
		<view class="s-addr-box">
			<view>
				<s-list-cell :hover="false" padding="0">
					<view class="s-line-cell">
						<view class="s-title">身份证号</view>
						<input type="text" placeholder-class="s-phcolor" class="s-input" v-model="idcard" placeholder="请输入请输入身份证号" maxlength="50" /> 
					</view> 
				</s-list-cell>
			</view>
			<view class="s-addr-save">
				<s-button type="danger" height="88upx" @click="get_idcard">确定</s-button>
			</view>
			<s-card :title="'相关信息'" v-if="info.area">
				<template v-slot:body>
					<view class="s-default">
						地址：{{info.area}}
					</view>
					<view class="s-default">
						出生年月日：{{info.birthday}}
					</view>
					<view class="s-default">
						性别：{{info.sex}}
					</view>
				</template>
			</s-card>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				idcard:'',
				info:{},
			}
		},
		methods: {
			async get_idcard(){
				var that =this;
				var idcard = that.idcard;
				if(idcard == ''){
					return await this.$s.uniApi.showToast({title: '请输入身份证号！'});
				}
				const data = await this.$s.model.juhe.get_idcard({idcard:idcard})
				if(data.code){
					this.info = data.data.result
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
@import 'idcard.scss';
</style>
